home *** CD-ROM | disk | FTP | other *** search
- VERSION 5.00
- Begin VB.Form LanguageSelect
- BorderStyle = 3 'Fixed Dialog
- Caption = "Select Language"
- ClientHeight = 2796
- ClientLeft = 36
- ClientTop = 336
- ClientWidth = 5088
- Icon = "LanguageSelect.frx":0000
- LinkTopic = "Form2"
- MaxButton = 0 'False
- MinButton = 0 'False
- ScaleHeight = 2796
- ScaleWidth = 5088
- ShowInTaskbar = 0 'False
- StartUpPosition = 2 'CenterScreen
- Begin VB.CheckBox chkShowOnStartup
- Caption = "Show this dialog when the program starts"
- Height = 252
- Left = 120
- TabIndex = 2
- Top = 2280
- Width = 3492
- End
- Begin VB.CommandButton OkButton
- Caption = "OK"
- Default = -1 'True
- Height = 372
- Left = 3840
- TabIndex = 1
- Top = 2280
- Width = 1092
- End
- Begin VB.ListBox LanguageList
- Height = 1968
- Left = 120
- TabIndex = 0
- Top = 120
- Width = 4812
- End
- Attribute VB_Name = "LanguageSelect"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- Option Explicit
- Private ShowOnStartup As Boolean
- Public Sub ShowDialog(Optional ByVal IsStartup As Boolean = True)
- Load Me
- 'This function can be called from Sub Main to:
- '- read settings from the registry and
- '- show the LanguageSelect Dialog.
- 'The LanguageSelect dialog has a check box to specify whether it
- 'should be shown on startup. Your program should provide some method
- 'other method to show this dialog, if the user disables it!
- 'The VB SaveSetting/GetSetting functions store the settings in
- '"HKEY_CURRENT_USER\Software\VB and VBA Program Settings".
- 'You may want to replace these functions with Windows API functions
- 'to store the settings somewhere else, such as
- '"HKEY_CURRENT_USER\Software\<my company>".
- If IsStartup Then
- Dim LangId As Long
- Dim Lang As String
- 'Read settings from registry
- LangId = GetSetting(App.EXEName, "MultiLang", "LangId", ml_OriginalLanguage)
- Lang = GetSetting(App.EXEName, "MultiLang", "LangName")
- 'Select the language specified in the registry
- ml_ChangeLanguage LangId, Lang
- 'Store the language in the runtime support object, so that seperately
- 'compiled components (.ocx, .dll) can start up in the same language.
- ' Set ml_RuntimeSupport = New MLSupport 'MLRUNTIMESUPPORT
- ' ml_RuntimeSupport.SetLanguage LangId, Lang 'MLRUNTIMESUPPORT
- End If
- 'Always read the ShowOnStartup flag from the registry
- ShowOnStartup = GetSetting(App.EXEName, "MultiLang", "ShowDialog", True)
- 'Initialise controls on the form
- InitialiseForm
- 'Show the language select dialog, unless the user deselected this option.
- If ShowOnStartup Or Not IsStartup Then
- Me.Show vbModal
-
- 'Save settings in the registry
- SaveSetting App.EXEName, "MultiLang", "LangId", ml_CurrentLanguageId
- SaveSetting App.EXEName, "MultiLang", "LangName", ml_LanguageName(ml_CurrentLanguageId)
- SaveSetting App.EXEName, "MultiLang", "ShowDialog", ShowOnStartup
- End If
- Unload Me
- End Sub
- Private Sub InitialiseForm()
- Dim Index As Long
- Dim LanguageID As Long
- Dim LanguageArray
- LanguageArray = ml_LanguageIds
- With LanguageList
- .Clear
- For Index = LBound(LanguageArray) To UBound(LanguageArray)
- LanguageID = LanguageArray(Index)
- .AddItem ml_LocaleName(LanguageID)
- .ItemData(.NewIndex) = LanguageID
-
- If LanguageID = ml_CurrentLanguageId Then
- .Selected(Index) = True
- End If
- Next
- End With
- chkShowOnStartup.Value = IIf(ShowOnStartup, vbChecked, vbUnchecked)
- End Sub
- Private Sub LanguageList_DblClick()
- OkButton_Click
- End Sub
- Private Sub OkButton_Click()
- With LanguageList
- If .ListIndex <> -1 Then
- ShowOnStartup = (chkShowOnStartup = vbChecked)
- ml_CurrentLanguageId = .ItemData(.ListIndex)
- ' ml_RuntimeSupport.SetLanguage ml_CurrentLanguageId, ml_LanguageName(ml_CurrentLanguageId) 'MLRUNTIMESUPPORT
- Me.Hide
-
- End If
- End With
- End Sub
- Private Sub ml_UpdateControls()
- 'Dummy
- End Sub
-